<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title>赛诺菲_西南区 销量统计系统</title>
		<%@ include file="../../inc/fileHead.jsp"%>
		<script type="text/javascript" src="js/FusionCharts/FusionCharts.js"></script>
	</head>
		<body class="easyui-layout">
		<div data-options="region:'north',title:'查询条件',iconCls:'icon-search'" style="height:60px">
		开始时间： 
		<input id="startDate" type="text" class="easyui-datebox"
			required="required"></input>
		结束时间：
		<input id="endDate" type="text" class="easyui-datebox"
			required="required"></input>
		sales名称：
		<input required="true" class="easyui-combobox" id="salesId"
			data-options="  
                    url:'BaseAction_selectGetSalesName',  
                    valueField:'id',  
                    textField:'name',  
                    panelHeight:'auto',
                    onSelect:function(rec){
                    var url = 'BaseAction_selectGetCustomerNameBySalesId?salesId='+rec.id; 
                     $('#customerNameId').combobox('reload', url); 
                    }
            " />
        客户名称：
        <input id="customerNameId" class="easyui-combobox"  style="width:400px"
			data-options="  
                    valueField:'id',  
                    textField:'name',  
                    panelHeight:'auto'  
            " />    
            <a href="javascript:void(0)" class="easyui-linkbutton"
			iconCls="icon-search" plain="true" onclick="submit()">查询</a>
		</div>
		<div id="chartContainer" data-options="region:'center',title:'查询结果'" style="text-align: center;">
			<img src="html/report.jpg">
		</div>
		<script type="text/javascript">    
		function submit(){
		var tag = true;
		if($('#salesId').combobox("getValue")==""){ 
			tag = false;
		}else if($('#startDate').datebox("getValue")==""){ 
			tag = false;
		}else if($('#endDate').datebox("getValue")==""){ 
			tag = false;
		}
		if(tag== false){
			$.messager.alert('提示','请输入查询条件');
			return;
		}
		if($('#startDate').datebox("getValue").substring(0,4)!=$('#endDate').datebox("getValue").substring(0,4)){
			$.messager.alert('提示','开始时间和结束时间不要跨年');
			return;
		}
		 var d1 = $.fn.datebox.defaults.parser($('#startDate').datebox("getValue"));  
         var d2 = $.fn.datebox.defaults.parser($('#endDate').datebox("getValue"));  
         if(d1>d2){
    		$.messager.alert('提示','开始时间不能晚于结束时间');
			return;    	
         } 
		var url="ReportAction_findSalesreport?customerNameId="+$('#customerNameId').combobox("getValue")+"&salesId="+$('#salesId').combobox("getValue")+"&startDate="+$('#startDate').combobox("getValue")+"&endDate="+$('#endDate').combobox("getValue");
               var myChart = new FusionCharts( "js/FusionCharts/Column3D.swf",  
                   "myChartId", "800", "500", "0" );
     	 				myChart.setJSONUrl(url);
      					myChart.render("chartContainer"); 
            }  
                 
    </script>
	</body>
</html>